<?php

	/** Une abstraction pour les sous fonctionalités
	 * @author Sebastian Mosser
	 */



abstract class aSubFeature {

	protected $_acl;
	
	// fonction a definir :
	protected abstract function run();
	
	
	// fonctions statiques communes
	public final function start($usersGroups) {
		if ($this->_acl->isExposable($usersGroups))
			return $this->run();
	}
	
	public final static function expose($serviceName,$htmlMaker,$pageInfo,$toc) {
     try {
        $serviceClass = new ReflectionClass($serviceName);
        $feature = $serviceClass->newInstance();
        $page = $feature->start(Login::getGroups());
        $pageInfo["$@USERLOGIN@$"] = Login::getLoginName(). " ";
        $pageInfo["$@USERLOGIN@$"] .= Season::titleBar(Login::seasonChoosen());
        $text = $htmlMaker->makePage($page,$pageInfo,$toc);
        $log = new Log(Login::getLoginName(),$_SERVER['REQUEST_URI']);
        $log->create();
        header('Content-Type: text/html; charset=UTF-8');
        header('Pragma: no-cache');
        echo $text;
      }
      catch(Exception $exc) {
        header('Content-Type: text/html; charset=UTF-8');
      	ExceptionDisplayer::throw2Screen($exc);
      	$log = new Log(Login::getLoginName(),$_SERVER['REQUEST_URI']."/FAIL/");
        $log->create();
      	exit();
      }
   }

}


?>